Skip to content

fix: calculator inputs placeholder#967

Merged
jvsena42 merged 5 commits into
masterfrom
fix/calc-placeholder
May 26, 2026
Merged

fix: calculator inputs placeholder#967
jvsena42 merged 5 commits into
masterfrom
fix/calc-placeholder

Conversation

@ovitrif
Copy link
Copy Markdown
Collaborator

@ovitrif ovitrif commented May 25, 2026

This PR ports calculator widget fixes from:

Description

This PR:

  1. Shows 0 as the empty placeholder for modern bitcoin and fiat calculator inputs.
  2. Shows 0.00000000 for empty classic bitcoin input and keeps the classic decimal placeholder tail for whole bitcoin values.
  3. Preserves the active calculator input as the refresh source when currency, bitcoin unit, or rate data changes.
  4. Updates calculator formatter and ViewModel tests.

Note Didn't add any changelog fragment because this is considered one unit of work in iOS as well and part of the calculator v61 redesign, should've been part of #942 ideally.

Preview

placeholder2x.mp4

QA Notes

Manual Tests

  • 1. Widgets → Calculator → empty modern Bitcoin input: placeholder shows 0.
  • 2. Settings → General → Bitcoin Unit Classic → Widgets → Calculator → empty Bitcoin input: placeholder shows 0.00000000.
  • 3. Widgets → Calculator → enter bitcoin amount → long-delete bitcoin input: fiat input shows 0 placeholder.
  • 4. Widgets → Calculator → select fiat input → enter fiat amount → change currency or Bitcoin unit: fiat text stays fixed while bitcoin recalculates from it.
  • 5. Widgets → Calculator → select Bitcoin input → enter bitcoin amount → rates refresh or currency changes: bitcoin text stays fixed while fiat recalculates from it.

Automated Checks

  • Unit tests updated: cover modern bitcoin, classic bitcoin, and fiat empty placeholders in app/src/test/java/to/bitkit/ui/screens/widgets/calculator/components/CalculatorCardStateTest.kt.
  • Unit tests added: cover active input refresh source selection in app/src/test/java/to/bitkit/ui/screens/widgets/calculator/components/CalculatorCardStateTest.kt and rate/currency refresh handling in app/src/test/java/to/bitkit/ui/screens/widgets/calculator/CalculatorViewModelTest.kt.
  • Local checks: ./gradlew testDevDebugUnitTest --tests to.bitkit.ui.screens.widgets.calculator.CalculatorViewModelTest --tests to.bitkit.ui.screens.widgets.calculator.components.CalculatorCardStateTest; ./gradlew compileDevDebugKotlin testDevDebugUnitTest detekt.

@ovitrif ovitrif added this to the 2.3.0 milestone May 25, 2026
@ovitrif ovitrif self-assigned this May 25, 2026
@ovitrif ovitrif changed the title fix: show calculator placeholders fix: calculator inputs placeholder May 25, 2026
@ovitrif ovitrif force-pushed the fix/calc-placeholder branch from 20a10ad to cdc3eb1 Compare May 25, 2026 12:47
chatgpt-codex-connector[bot]

This comment was marked as resolved.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

@ovitrif ovitrif force-pushed the fix/calc-placeholder branch from 45852b3 to 88559ff Compare May 25, 2026 13:52
chatgpt-codex-connector[bot]

This comment was marked as resolved.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

Copy link
Copy Markdown
Member

@jvsena42 jvsena42 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested

  • Switch between classical/modern -> BTC input updated
  • Change currency -> Conversion updated
  • Close the app
  • Physical keyboard

@piotr-iohk
Copy link
Copy Markdown
Collaborator

Testing Notes

  • empty BTC shows 0 in modern and 0.00000000 in classic
  • empty fiat show 0
  • classic BTC tail 0s dimmed
  • recalculates btc / fiat on rate change
  • behavior ok on different in-app widget position (top/down/middle)

The only thing is that https://bitkit.stag0.blocktank.to/fx/rates/btc has some pairs stale (e.g. BTCUSD) which causes mismatches in staging build. Flagged in https://synonymworkspace.slack.com/archives/C03UWHGKUNP/p1779786482683179, but perhaps we can just consider using https://blocktank.synonym.to/fx/rates/btc for all builds across the board.

@jvsena42 jvsena42 merged commit 895cee1 into master May 26, 2026
17 checks passed
@jvsena42 jvsena42 deleted the fix/calc-placeholder branch May 26, 2026 10:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants